import type { TycCustomerForm, TycCustomerQuery, TycCustomerVO } from './model';

import type { ID, IDS, PageResult } from '#/api/common';

import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';

/**
 * 分页查询天眼查企业客户列表
 * @param params
 * @returns 天眼查企业客户列表
 */
export function tycCustomerPage(params?: TycCustomerQuery) {
  return requestClient.get<PageResult<TycCustomerVO>>(
    '/tyc/company/customer/page',
    {
      params,
    },
  );
}

/**
 * 查询天眼查企业客户列表
 * @param params
 * @returns 天眼查企业客户列表
 */
export function tycCustomerList(params?: TycCustomerQuery) {
  return requestClient.get<TycCustomerVO[]>('/tyc/company/customer/list', {
    params,
  });
}

/**
 * 导出天眼查企业客户列表
 * @param params
 * @returns 天眼查企业客户列表
 */
export function tycCustomerExport(params?: TycCustomerQuery) {
  return commonExport('/tyc/company/customer/export', params ?? {});
}

/**
 * 查询天眼查企业客户详情
 * @param id id
 * @returns 天眼查企业客户详情
 */
export function tycCustomerInfo(id: ID) {
  return requestClient.get<TycCustomerVO>(`/tyc/company/customer/${id}`);
}

/**
 * 新增天眼查企业客户
 * @param data
 * @returns void
 */
export function tycCustomerAdd(data: TycCustomerForm) {
  return requestClient.postWithMsg<void>('/tyc/company/customer', data);
}

/**
 * 更新天眼查企业客户
 * @param data
 * @returns void
 */
export function tycCustomerUpdate(data: TycCustomerForm) {
  return requestClient.putWithMsg<void>('/tyc/company/customer', data);
}

/**
 * 删除天眼查企业客户
 * @param id id
 * @returns void
 */
export function tycCustomerRemove(id: ID | IDS) {
  return requestClient.deleteWithMsg<void>(`/tyc/company/customer/${id}`);
}
